<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="js/global.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/arrlist.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			$(function(){
				init();
				
			} )
			//分页添加查找
			function init() {
				
				$("#emptab").datagrid({
					url: 'http://127.0.0.1:8080/findAllEmployee', 
					method:"post",
					pagination:true,
					queryParams:{
						eYongchu:2
					}
				});
				$("#ss").form("reset");
			}
			//设置
			function shezhi(value, row, index) {
				return  '<a href="javascript:void(0)" class="easyui-linkbutton" onclick="deleteEmp('+index+')">删除</a> <a href="javascript:void(0)" class="easyui-linkbutton" onclick="updateEmp('+index+')">查看</a>';
			}
			function tuijianm(value, row, index) {
				return  '<a href="javascript:void(0)" class="easyui-linkbutton" onclick="mianshi('+index+')">推荐面试</a>';
			}
			
			//推荐面试
			function mianshi(index) {
				var data = $("#emptab").datagrid("getData"); 
				var row = data.rows[index]; 
				$.messager.confirm('确认', '您确认想要推荐面试吗？', function(r) {
					if(r) { 
						$.post("http://127.0.0.1:8080/saveMianshi", {
							msEid:row.eid,
							msZhuangtai:"待面试"
						}, function(res) {
							if(res){
								alert("推荐面试成功");
								$("#emptab").datagrid("load");
							}
						});
					}
				});

			}
			
			//类别
			/*function leibie(value, row, index) {
				return  row.ptype.ptName;
			}*/
			//删除
			function deleteEmp(index) {
				var data = $("#emptab").datagrid("getData"); 
				var row = data.rows[index]; 
				$.post("http://127.0.0.1:8080/findByeName",{
					eName:row.ename
				},function(rows){
					rows.eType=3;
					$.messager.confirm('确认', '您确定要把这条简历设为不合适吗？', function(r) {
					if(r) { 
						$.post("http://127.0.0.1:8080/saveEmployee", {
							Employee:rows
						}, function(res) {
							if(res){
								alert("删除成功");
								$("#emptab").datagrid("load");
							}
						});
					}
				});
				},"json")
				

			}
			//打开增加面板
			function insertEmp(index) {
				$("#insertEmp_window").window("open");    
				$('#ptnameadd').combobox({    
				    url:'http://127.0.0.1:8080/selectPtype',    
				    valueField:'ptId',    
				    textField:'ptName'   
				}); 
			}
			function closeUserForm1() {
				$("#insertEmp_window").window("close");
			}
			function submitupdateEmpForm1() {
					var profesidadd  = $("#profesidadd" ).val();//职业分类
					var eYuanxiaoadd  = $("#eYuanxiaoadd" ).val();//院校
					var eYaoqiuadd  = $("#eYaoqiuadd" ).val();//要求
					var eProfesadd  = $("#eProfesadd" ).val();//职业名称
					var eZzpleixingadd  = $("#eZzpleixingadd" ).val();//招聘类型
					var eNameadd  = $("#eNameadd" ).val();//名称
					var eSexadd  = $("#eSexadd" ).val();//性别
					var eEmailadd  = $("#eEmailadd" ).val();//
					var ePhoneadd  = $("#ePhoneadd" ).val();
					var eQqadd  = $("#eQqadd" ).val();
					var eCellphoneadd  = $("#eCellphoneadd" ).val();
					var eAddressadd  = $("#eAddressadd" ).val();
					var ePostcodeadd  = $("#ePostcodeadd" ).val();//邮编
					var eNationalityadd  = $("#eNationalityadd" ).val();//国籍
					var eBirthplaceadd  = $("#eBirthplaceadd" ).val();
					var eBirthdayadd  = $("#eBirthdayadd" ).val();//出生地
					var eNationadd  = $("#eNationadd" ).val();//民族
					var efaithadd  = $("#efaithadd" ).val();//宗教
					var epoliticsadd  = $("#epoliticsadd" ).val();//政治面貌
					var eNoadd  = $("#eNoadd" ).val();//身份证
					var eAgeadd  = $("#eAgeadd" ).val();
					var eEducationadd  = $("#eEducationadd" ).val();//学历
					var eEducationageadd  = $("#eEducationageadd" ).val();//教育年限
					var eMajoradd  = $("#eMajoradd" ).val();//学历专业
					var eSpecialtyadd  = $("#eSpecialtyadd" ).val();//特长
					var eHobbyadd  = $("#eHobbyadd" ).val();//爱好
					var eRecordadd  = $("#eRecordadd" ).val();//个人履历
					var eRemarkadd  = $("#eRemarkadd" ).val();//备注
				$.post(
					"http://127.0.0.1:8080/saveEmployee", {
						eYuanxiao:eYuanxiaoadd,
						eYaoqiu:eYaoqiuadd,
						pId:profesidadd,
						eProfes:eProfesadd,
						eZhicheng:eZzpleixingadd,
						eName:eNameadd,
						eSex:eSexadd,
						eEmail:eEmailadd,
						ePhone:ePhoneadd,
						eQq:eQqadd,
						eCellphone:eCellphoneadd,
						eAddress:eAddressadd,
						ePostcode:ePostcodeadd,
						eNationality:eNationalityadd,
						eBirthplace:eBirthplaceadd,
						eBirthday:eBirthdayadd,
						eNation:eNationadd,
						efaith:efaithadd,
						epolitics:epoliticsadd,
						eNo:eNoadd,
						eAge:eAgeadd,
						eEducation:eEducationadd,
						eEducationage:eEducationageadd,
						eMajor:eMajoradd,
						eSpecialty:eSpecialtyadd,
						eHobby:eHobbyadd,
						eRecord:eRecordadd,
						eRemark:eRemarkadd,
						eYongchu:2
					},
					function(res) {
						if(res>0) {
							alert("增加成功"); 
							$("#insertEmp_window").window("close");
							$("#emptab").datagrid("reload");
						}
					}, "json");
			}
			
			//修改
			function updateEmp(index) {
				var data = $("#emptab").datagrid("getData");
				var row = data.rows[index]; 
				$("#updateEmp_window").window("open"); 
				$("#updateEmpForm").form("load", row); 
				$('#ptname').combobox({    
				    url:'http://127.0.0.1:8080/selectPtype',    
				    valueField:'ptId',    
				    textField:'ptName'   
				}); 
				$('#ptname').combobox('setValue',row.ptype.ptName);
				
			}

			function closeUserForm() {
				$("#updateEmp_window").window("close");
			}

			function submitupdateUserForm() {
				var proId = $("#proId").val();
				var proName = $("#proName").val();
				var proPrice = $("#proPrice").val();
				
				var ptname=$('#ptname').combobox('getValue');
				
				
				$.post(
					"http://127.0.0.1:8080/save", {
						proId: proId,
						proName: proName,
						proPrice: proPrice,
						ptId: ptname,
					},
					function(res) {
						if(res>0) {
							alert("修改成功"); 
							$("#updateEmp_window").window("close");
							$("#emptab").datagrid("reload");
						}
					}, "json");
			}
		</script>
	</head>
	<body>
		<!--查询表单-->
		<!--<form id="ss">
			
				<label>姓名:</label> 
				<input class="easyui-textbox" type="text"  id="proNamesel" ></input>
				<label>类别:</label> 
				<input class="easyui-combobox" id="ptnamesel" name="ptnamesel" value="--请选择--">  
			<a href="javascript:void(0)" class="easyui-linkbutton" onclick="init()">查找</a>
			
			
		</form>-->
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="insertEmp()">增加</a>
		<!--表格显示-->
		<table id="emptab"   class="easyui-datagrid" title="简历管理" data-options="singleSelect:true,collapsible:true,pagination:true,toolbar:'#tb'">
			<thead>
				<tr>
					<th data-options="field:'eid'">编号</th>
					<th data-options="field:'ename'">姓名</th>
					<th data-options="field:'esex'">性别</th>
					<th data-options="field:'yijigou'">一级机构</th>
					<th data-options="field:'erjigou'">二级机构</th>
					<th data-options="field:'sanjigou'">二级机构</th>
					<th data-options="field:'eprofes'">职位分类</th>
					<th data-options="field:'ezhicheng'">职位名称</th>
					<th data-options="field:'tuijian',title:'推荐面试',formatter:tuijianm"></th>
					<th data-options="field:'caozuo',title:'操作',formatter:shezhi"></th>
					<!--,formatter:leibie-->
				</tr>
			</thead>
		</table>
		<div id="insertEmp_window" class="easyui-window" title="增加" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:670px;height:530px;padding:10px;">
			<table>
				<tr>
					<td>职位分类</td>
					<td><input  type="text"  id="profesidadd" style="width:80px;"></td>
					<td>职位名称</td>
					<td><input  type="text"  id="eProfesadd" style="width:80px;"></td>
					<td>招聘类型</td>
					<td colspan="2"><input  type="text"  id="eZzpleixingadd" style="width:160px;"></td>
				</tr>
				<tr>
					<td>姓名</td>
					<td><input  type="text"  id="eNameadd" style="width:80px;"></td>
					<td>性别</td>
					
					<td><input  type="text"  id="eSexadd" style="width:80px;"></td>
						
						<!--<td><select id="eSexadd" class="easyui-combobox"  style="width:84px;">   
							<option value=""></option>
							<option value="1">男</option>   
							<option value="2">女</option>   
						</select></td> -->
					
					<td>EMATL</td>
					<td colspan="2"> <input  type="text"  id="eEmailadd" style="width:160px;"></td>
				</tr>
				<tr>
					<td>电话</td>
					<td><input  type="text"  id="ePhoneadd" style="width:80px;"></td>
					<td>QQ</td>
					<td><input  type="text"  id="eQqadd" style="width:80px;"></td>
					<td>手机</td>
					<td colspan="2"><input  type="text"  id="eCellphoneadd" style="width:160px;"></td>
				</tr>
				<tr>
					<td>住址</td>
					<td colspan="3"	><input  type="text"  id="eAddressadd" style="width:220px;"></td>
					
					<td>邮编</td>
					<td colspan="2"><input  type="text"  id="ePostcodeadd" style="width:160px;"></td>
				</tr>
				<tr>
					<td>国籍</td>
					
					<td><input  type="text"  id="eNationalityadd" style="width:80px;"></td>
					<!--	<td>
					<select id="eNationalityadd" class="easyui-combobox"  style="width:84px;">  
							<option value="中国大陆">中国大陆</option>  
							<option value="台湾">台湾</option>
                            <option value="菲律宾">菲律宾</option>
                            <option value="美国">美国</option>
                            <option value="日本">日本</option>
                            <option value="丹麦">丹麦</option>
                            <option value="英国">英国</option>
                            <option value="德国">德国</option>
                            <option value="法国">法国</option>
                            <option value="意大利">意大利</option>
					</select></td> -->
					
					<td>出生地</td>
					<td><input  type="text"  id="eBirthplaceadd" style="width:80px;">
					</td>
					<td>生日</td>
					
					<td><input  type="text"  id="eBirthdayadd" style="width:80px;"></td>
						
					<!--<td>	<input  id="eBirthdayadd" type= "text" class= "easyui-datebox" style="width:84px;"> </input> 
					</td>-->
					<td>民族</td>
					<td><input  type="text"  id="eNationadd" style="width:80px;"></td>
					
				<!--	<td><select id="eNationadd"   style="width:84px;"> </select></td>
				--></tr>
				<tr>
					<td>宗教信仰</td>
					
					<td><input  type="text"  id="efaithadd" style="width:80px;"></td>
						
					<!--	<td><select id="efaithadd"   style="width:84px;"> </select>
					</td>-->
					<td>政治面貌</td>
					<td><input  type="text"  id="epoliticsadd" style="width:80px;"></td>
					
					<!--<td><select id="epoliticsadd"   style="width:84px;"> </select></td>
					--><td>身份证号</td>
					<td><input  type="text"  id="eNoadd" style="width:80px;"></td>
					<td>毕业院校</td>
					<td><input  type="text"  id="eYuanxiaoadd" style="width:80px;"></td>
				</tr>
				<tr>
					<td>年龄</td>
					<td><input  type="text"  id="eAgeadd" style="width:80px;"></td>
					<td>学历</td>
					
					<td><input  type="text"  id="eEducationadd" style="width:80px;"></td>
						
						<!--
					<td>	
						<select id="eEducationadd" class="easyui-combobox"  style="width:84px;">  
							<option value=""></option>  
							<option value="博士">博士</option>  
							<option value="硕士">硕士</option>
                            <option value="本科">本科</option>
                            <option value="大专">大专</option>
                            <option value="中专">中专</option>
                            <option value="高中">高中</option>
                            <option value="初中">初中</option>
                            <option value="小学">小学</option>
                            <option value="其他">其他</option>
					</select>
					</td>
					-->
					
					<td>教育年限</td>
					<td><input  type="text"  id="eEducationageadd" style="width:80px;"></td>
					
					<!--<td><select id="eEducationageadd"   style="width:84px;"> </select>
					</td>-->
					<td>学历专业</td>
					<td><input  type="text"  id="eMajoradd" style="width:80px;"></td>
				</tr>
				<tr>
					<td>薪酬要求</td>
					<td><input  type="text"  id="eYaoqiuadd" style="width:80px;"></td>
					<td>注册时间</td>
					<td><input  type="text"  id="eZcdateadd" style="width:80px;"></td>
					<td>特长</td>
					<td><input  type="text"  id="eSpecialtyadd" style="width:80px;"></td>
					<td>爱好</td>
					<td><input  type="text"  id="eHobbyadd" style="width:80px;"></td>
					
				</tr>
				<tr>
					<td>个人履历</td>
					<td colspan="7"><input  type="text"  id="eRecordadd" style="width:530px;height:50px;"></td>
				</tr>
				<tr>
					<td>备注</td>
					<td colspan="7"><input  type="text"  id="eRemarkadd" style="width:530px;height:50px;"></td>
				</tr>
				<tr>
					<td></td>
					<td></td>
					<td colspan="2"><a href="javascript:void(0)" class="easyui-linkbutton"  style="width:80px;"  onclick="submitupdateEmpForm1()">保存</a></td>
					<td colspan="2"><a href="javascript:void(0)" class="easyui-linkbutton"  style="width:80px;" onclick="closeEmpForm1()">取消</a></td>
					<td></td>
					<td></td>
				</tr>
			</table>
					
			
		</div>
		<div id="updateEmp_window" class="easyui-window" title="修改" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:500px;height:300px;padding:10px;">
			<form id="updateEmpForm">
					<table>
				<tr>
					<td>职位分类</td>
					<td><input  type="text"  name="profesid" style="width:80px;"></td>
					<td>职位名称</td>
					<td><input  type="text"  name="eProfes" style="width:80px;"></td>
					<td>招聘类型</td>
					<td colspan="2"><input  type="text"  name="eZzpleixing" style="width:160px;"></td>
				</tr>
				<tr>
					<td>姓名</td>
					<td><input  type="text"  name="eName" style="width:80px;"></td>
					<td>性别</td>
					
					<td><input  type="text"  name="eSex" style="width:80px;"></td>
					
					<td>EMATL</td>
					<td colspan="2"> <input  type="text"  name="eEmail" style="width:160px;"></td>
				</tr>
				<tr>
					<td>电话</td>
					<td><input  type="text"  name="ePhone" style="width:80px;"></td>
					<td>QQ</td>
					<td><input  type="text"  name="eQq" style="width:80px;"></td>
					<td>手机</td>
					<td colspan="2"><input  type="text"  name="eCellphone" style="width:160px;"></td>
				</tr>
				<tr>
					<td>住址</td>
					<td colspan="3"	><input  type="text"  name="eAddress" style="width:220px;"></td>
					
					<td>邮编</td>
					<td colspan="2"><input  type="text"  name="ePostcode" style="width:160px;"></td>
				</tr>
				<tr>
					<td>国籍</td>
					
					<td><input  type="text"  name="eNationality" style="width:80px;"></td>
					
					
					<td>出生地</td>
					<td><input  type="text"  name="eBirthplace" style="width:80px;">
					</td>
					<td>生日</td>
					
					<td><input  type="text"  name="eBirthday" style="width:80px;"></td>
					
					<td>民族</td>
					<td><input  type="text"  name="eNation" style="width:80px;"></td>
					</tr>
				<tr>
					<td>宗教信仰</td>
					
					<td><input  type="text"  name="efaith" style="width:80px;"></td>
					
					<td>政治面貌</td>
					<td><input  type="text"  name="epolitics" style="width:80px;"></td>
					<td>身份证号</td>
					<td><input  type="text"  name="eNo" style="width:80px;"></td>
					<td>毕业院校</td>
					<td><input  type="text"  name="eYuanxiao" style="width:80px;"></td>
				</tr>
				<tr>
					<td>年龄</td>
					<td><input  type="text"  name="eAge" style="width:80px;"></td>
					<td>学历</td>
					
					<td><input  type="text"  name="eEducation" style="width:80px;"></td>
					
					<td>教育年限</td>
					<td><input  type="text"  name="eEducationage" style="width:80px;"></td>
					
					<td>学历专业</td>
					<td><input  type="text"  name="eMajor" style="width:80px;"></td>
				</tr>
				<tr>
					<td>薪酬要求</td>
					<td><input  type="text"  name="eYaoqiu" style="width:80px;"></td>
					<td>注册时间</td>
					<td><input  type="text"  name="eZcdate" style="width:80px;"></td>
					<td>特长</td>
					<td><input  type="text"  name="eSpecialty" style="width:80px;"></td>
					<td>爱好</td>
					<td><input  type="text"  name="eHobby" style="width:80px;"></td>
					
				</tr>
				<tr>
					<td>个人履历</td>
					<td colspan="7"><input  type="text"  name="eRecord" style="width:530px;height:50px;"></td>
				</tr>
				<tr>
					<td>备注</td>
					<td colspan="7"><input  type="text"  name="eRemark" style="width:530px;height:50px;"></td>
				</tr>
				<tr>
					<td></td>
					<td></td>
					<td colspan="2"><a href="javascript:void(0)" class="easyui-linkbutton"  style="width:80px;"  onclick="submitupdateEmpForm1()">保存</a></td>
					<td colspan="2"><a href="javascript:void(0)" class="easyui-linkbutton"  style="width:80px;" onclick="closeEmpForm1()">取消</a></td>
					<td></td>
					<td></td>
				</tr>
			</table>
			</form>
			<div style="text-align:center;padding:5px">
				<a href="javascript:void(0)" class="easyui-linkbutton" type="button" onclick="submitupdateUserForm()">保存</a>
				<a href="javascript:void(0)" class="easyui-linkbutton" onclick="closeUserForm()">取消</a>
			</div>
		</div>
		
	</body>
</html>
